/**
 * map类的实现
 * size
 * set(key,value),重复的话就覆盖
 * get(key)
 * has(key)
 * delete(key)
 * clear()
 */
function MyMap(arr) {
  let length = 0
  let obj = new Object()

  this.set = (key, value) => {
    if (!this.has(key)) {
      ++length
    }
    obj[key] = value
  }
  this.get = (key) => {
    if (!this.has(key)) {
      return obj[key]
    } else {
      return undefined
    }
  }
  this.has = (key) => {
    return (key in obj)
  }
  this.delete = (key) => {

  }
  this.size = () => {
    return length
  }
  this.clear = () => {
    length = 0
    obj = new Object()
  }

}




const arr = [['Michael', 95], ['Bob', 75], ['Tracy', 85]]
let temp = new MyMap(arr)
// let temp = new Map(arr)
console.log(temp);